package spine.starling
{
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	import starling.display.DisplayObject;
	import starling.display.Sprite;
	import starling.events.Event;
	
	public class PuppetModel extends Sprite
	{
		
		public var reflexModel:Sprite=new Sprite();
		public var scaleModel:Sprite=new Sprite();
		public function PuppetModel()
		{
			super();
			addEventListener(Event.ADDED_TO_STAGE,addToStage);
		}
		
		private function addToStage(e:Event):void
		{
			removeEventListener(Event.ADDED_TO_STAGE,addToStage);
			scaleModel.addChild(reflexModel);
			addChild(scaleModel);
		}
		
		public function addElement(child:DisplayObject):void
		{
			reflexModel.addChild(child);
		}
		
		//设置倒影xy偏移量
		public function set offset(point:Point):void
		{
			this.x=point.x;
			this.y=point.y;
		}
		
		//设置倒影xy整体坐标
		public function set position(point:Point):void
		{
			reflexModel.x=point.x;
			reflexModel.y=point.y;
		}
		
		public function clear():void
		{
			reflexModel.removeChildren(0,-1);
		}
	}
}